1. Technical Field
The present invention relates in general to fault injection into a computer system, and, in particular, to automatic fault injection into a JAVA Virtual Machine.
2. Description of the Related Art
JAVA programming and applications and the JAVA language are well known in the art. With reference now to the figures and in particular with reference to FIG. 1, a prior art example block diagram 2 illustrating a general topology for processing and interpreting a JAVA program or application is shown. The JAVA program or application is in the form of a JAVA source code at block 4. The JAVA source code is compiled into JAVA byte code at block 6. The user computer 10 has within it a JAVA virtual machine (JVM) 12 to receive the JAVA byte code and interpret it for use by the user computer 10. A debugging computer 10 is able to access the JAVA byte code for debugging the JAVA program and application or JAVA code at that stage.
JVMs are well known in the art. With reference now to the figures and in particular with reference to FIG. 2, a prior art block diagram of an example JVM 12 is shown. The JVM 12 is shown to have a control section 22, a data section 24, and a code section 26. The control section 22 handles and processes JAVA objects. JAVA objects each have a specified class which call upon a method and respective attributes. Thus, the control section 22 comprises a classes sub-section 14, a methods sub-section 16, and an attributes sub-section 18. The data section 24 holds data for the JVM 12, and the code section 26 provides the code for the various methods and attributes of JAVA objects. For example, FIG. 2 shows that the JAVA object 20 is defined by the class xe2x80x9cFOOxe2x80x9d wherein xe2x80x9cFOOxe2x80x9d is described within the classes section 14. xe2x80x9cFOOxe2x80x9d has methods xe2x80x9cstartxe2x80x9d or xe2x80x9cstopxe2x80x9d in the methods section 16. The attributes of the stop method are accessed in the attributes section 18. The stop attributes describe the method and would typically include location information as well as exceptions or faults, such as xe2x80x9cfailxe2x80x9d, xe2x80x9cretryxe2x80x9d, or xe2x80x9cabortxe2x80x9d that the method could have when executing.
FIG. 2 further shows that the JVM 12 also has a debugger 28 that debugs the JAVA program or application being handled and processed by the JVM 12. Breakpoints are inserted into the JAVA code at appropriate or desired places where debugging is to be performed, and the debugger 28 is called upon to execute a respective debugging algorithm to debug the code wherever these various breakpoints exist. These debuggers 28 and breakpoints for JVMs 12 are well known in the art.
Presently, injection of faults into software systems has been done to test reliability and obtain results by simulating various fault or error conditions so that the code is verified to handle the fault or error properly. Fault injection generally involves the manual input of codes and/or commands for simulating the various fault and error conditions under various conditions. The fault injection is typically done by injecting the code with failure situations or faults. In a JAVA program or the faults or errors are manually injected via the JAVA source code through conditional execution (i.e. if fault should occur in this condition, then throw an exception (throw the fault)). The problem with this manner of fault injection is that it is manually performed. All possible faults and errors must be manually searched for and found, and a code for injecting each fault and error under all conditions must be created, inserted, and respectively executed. Thus, the manual creation and insertion of the code for faults and errors is extremely tedious, laborious, and/or difficult. Also, the maintenance of this injected code is also very difficult, laborious, and tedious since various conditions for exceptions (i.e. faults) may change or vary. Since manual fault injection is a very laborious and tedious tasks, many users of the JAVA application or program will skip these tests of the JAVA application or program. Thus, reliability and proper handling of faults or exceptions under various conditions by the JAVA program or application would not be tested or verified.
It would therefore be advantageous and desirable to provide an easy way of injecting faults and errors into a JAVA application or program to test the handling of various faults and exceptions under various conditions. It would also be advantageous and desirable to provide an easy way of maintaining the faults and errors injected into the JAVA application or program that test the handling of the faults and exceptions under various conditions. It would further be advantageous and desirable to provide an automatic fault injection system and method into a computer application or program, particularly into a JAVA application or program, wherein the automatic fault injection is configured to test the reliable and proper handling of various faults and exceptions under various conditions.
It is therefore one object of the present invention to an easy way of injecting faults and errors into a JAVA application or program to test the handling of various faults and exceptions under various conditions.
It is another object of the present invention to provide an easy way of maintaining the faults and errors injected into the JAVA application or program that test the handling of the faults and exceptions under various conditions.
It is a further object of the present invention to provide an automatic fault injection system and method into a computer application or program, particularly into a JAVA application or program, wherein the automatic fault injection is configured to test the reliable and proper handling of various faults and exceptions under various conditions.
The foregoing objects are achieved as is now described. A system and method of automatically injecting faults and errors into a JAVA application or program to test the reliable and proper handling of various faults and exceptions under various conditions. An automatic fault injector is coupled to the Java Virtual Machine (JVM). The JAVA program is initiated to inject the faults by determining locations within the JAVA program to where respective faults are to be injected. All the faults are found from the JAVA objects by traversing the class for each of the JAVA objects and searching for all exceptions from the classes, their methods, and their respective attributes. Determination is made of whether and when one of the respective faults be injected. An exception is automatically and timely triggered to inject a respective fault by the automatic fault injector at a corresponding locations when the corresponding location has been reached and when it has determined that the respective fault should be injected at an appropriate time. The determination of whether and when a fault or error is to be automatically injected is based on the setting of an automatic fault injection option.
The above as well as additional objects, features, and advantages of the present invention will become apparent in the following detailed written description.